<include file="Public/header" />
    <title>借款认证</title>
    <link rel="stylesheet" href="__PUBLIC__/Api/assets/css/reset.css">
    <link rel="stylesheet" href="__PUBLIC__/Api/assets/css/borrow.css">
    <link rel="stylesheet" href="__PUBLIC__/Api/assets/css/font-awesome.min.css">
    <style>
        html,
        body {
            height: 100%;
            overflow: hidden;
            width: 100%;
        }

        .clearfix:after {
            content: "";
            display: block;
            clear: both;
        }

        #shareBtn {
            cursor: pointer;
        }

        .panel {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            padding: 10px;
            width: 300px;
            border: 1px solid;
            border-radius: 5px;
            background: #fff;
            display: block;
            z-index: 2;
            border: none;
            line-height: 2;
            text-align: center;
        }

        .panel .close {
            float: right;
            margin-top: 15px;
            margin-right: 15px;
            font-size: 1.15rem;
            cursor: pointer;
        }

        .panel .sure,
        .panel .cancel {
            border: 1px solid;
            border-radius: 5px;
            margin: 5px;
            padding: 5px;
            float: right;
            cursor: pointer;
        }

        .shadow {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: #ccc;
            opacity: 0.75;
            z-index: 1;
            display: block;
        }

        .share-tips {
            position: absolute;
            bottom: 30%;
            left: 0;
            width: 100%;
            color: #e2531a;
            text-align: center;
            font-size: 23px;
        }

        .bor-header {
            z-index: 999;
        }

        .share {
            position: absolute;
            right: .6rem;
            color: black;
            letter-spacing: 2px;
        }

        .share-tips-text {
            position: absolute;
            right: 0rem;
            width: 70%;
            top: 0rem;
            height: 6rem;
            color: #dc7a0a;
        }

        .share-tips-text i {
            font-size: 2rem;
            float: right;
        }

        .share-tips-text p {
            color: #1b1b1b;
            font-weight: bold;
            font-size: 1.5rem;
        }
    </style>
</head>

<body>
<!--<div class="bor-header">借款认证-->
    <!--<i class="fa fa-angle-left back" onclick="goback()"></i>-->
    <!--<i class="share">...</i>-->
<!--</div>-->
<div class="borrow-content" style="padding-top: 50%">
    <img class="code" id="code" src="<?php echo $applogo?>" alt="">
</div>

<div class="shadow">
    <div class="share-tips-text">
        <i class="fa fa-arrow-up"></i>
        <p class="share-tips">点击上方"...",分享朋友圈</p>
    </div>
    <p class="share-tips">分享朋友圈，完成验证</p>
</div>
<script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
    function goback() {
        history.go(-1); //返回上一页
    }

//    window.addEventListener("click", function () {
//        panel.style.display = "none";
//        shadow.style.display = "none";
//    });

//    $('.fa').on('click', function (e) {
//        e.stopPropagation();
//        console.log(1)
        var urlx="http://<?php echo $ym.U('Home/fx_tz')?>";
        $.get("{:U('Home/borrow_fx')}", {"url":location.href.split('#').toString()}).done(function (data) {
//        $.get("{:U('Home/borrow_fx')}", {"url":urlx}).done(function (data) {
            // 注意这里的url，一定要这样写，也就是动态获取，不然也不会成功的。
//                console.log(data);
            if (data) {
//                    var wx_info = data.body.result.wx_info;
                var wx_info = data;

                if (wx_info.signature != null) {
                    // 配置
                    wx.config({
                        debug: false,   // 测试阶段，可以写为true，主要是为了测试是否配置成功
                        appId: wx_info.appId,
                        timestamp: wx_info.timestamp,
                        nonceStr: wx_info.nonceStr,
                        signature: wx_info.signature,
                        jsApiList: ['checkJsApi', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ',                                'onMenuShareQZone']
//                            jsApiList: ['updateTimelineShareData']
                    });

                    var title = "<?php echo $apptitle?>";
                    //var title = "<?php echo $apptitle?>";
                    //var desc = "<?php echo $apptitle?>";
                    var desc = "借款就找淘宝贷";
                    // 分享的图片，最好是正方形，不是也没关系，但是一定是http模式，即绝对路径，而不是服务器路劲
                    var imgUrl = "http://<?php echo $ym.$applogo?>";
                    // 这里的地址可以写死，也可以动态获取，但是一定不能带有微信分享后的参数，不然分享也是失败的
//                        var link = "https://www.czbke.com/";
//                    var link = wx_info.url;
//                    var link = "<?php echo $appxz?>";
                    var link = urlx;


                    // 分享给朋友、QQ、微博
                    var shareData = {
                        "imgUrl": imgUrl,
                        "title": title,
                        "desc": desc,
                        'link': link
                    };
                    // 分享到朋友圈
                    var shareToTimeline = {
                        "imgUrl": imgUrl,
                        "title": title,
                        'link': link,

                        "desc": desc,
                        success: function () {
                            $.post("",{id:"<?php echo $id?>"},function (abc) {
                            },'json')
// 用户确认分享后执行的回调函数
                        },
                        cancel: function () {
// 用户取消分享后执行的回调函数
                            alert('分享朋友圈，完成验证');
                        }
                    };
                    wx.ready(function() {
//                            wx.updateTimelineShareData(shareToTimeline, function(res) {
//这里是回调函数
//                            });

                        wx.onMenuShareTimeline(shareToTimeline);
                        wx.onMenuShareAppMessage(shareData);
//                            wx.onMenuShareQQ(shareData);
//                            wx.onMenuShareQZone(shareData);


                        wx.error(function(res) {
//                            alert(res.errMsg);
                        });
                    });
                }
            }
        }).fail(function (msg) {
//            alert('cl');
//            console.log("error:" + msg);
        });
//    })
</script>
</body>

</html>
